﻿String.prototype.HTMLEncode = function HTMLEncode()
{
	var sb = new StringBuilder();
	for (var i = 0; i < this.length; ++i)
	{
		switch (this.charAt(i))
		{
			case '<': sb.Append("&lt;"); break;
			case '>': sb.Append("&gt;"); break;
			case '&': sb.Append("&amp;"); break;
			default:
				sb.Append(this.charAt(i));
		}
	}
	return sb.toString();
}
